#ifndef JSPARSE_H
#define JSPARSE_H

#include <glib.h>
#include "jstypes.h"

typedef struct
{
	gchar *name;
	JSParseNode *list;
} FuncCall;

struct Context;
typedef struct Context Context;

struct Context
{
	GList *local_var;
	gint bline, eline;
	Context *parent;
	GList *childs;
	gchar *func_name;
	GList *ret_type;
	GList *func_arg;/*name only*/
};

typedef struct
{
	gchar *name;
	JSParseNode *node;
	gint line;
} Var;

typedef struct
{
	gchar *name;
	gboolean isFuncCall;
} Type;

GList* get_member_from_rc (JSParseNode* node);
JSParseNode* get_member_rc (JSParseNode* node, const gchar *mname);
JSParseNode* parse_file (const gchar *name);
const gchar* get_node_name (JSParseNode *node);
Type* get_node_type (JSParseNode *node, Context *my_cx);
void print_node (JSNode *node, char *pref);
void jsnode_free (JSNode *node);

Context* js_context_new (Context *parent);
void js_context_free (Context *self);
void print_context (Context *my_cx, const gchar *str);

GList* get_lines_missed_semicolon ();
void interpretator (JSParseNode *node, Context *my_cx, GList **calls);
JSParseNode* find_last_assignment (const gchar *name, Context *my_cx);

#endif





